package com.example.lp.lpuicore.anim;

import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.RotateAnimation;
import android.view.animation.ScaleAnimation;
import android.view.animation.TranslateAnimation;

import com.example.lp.lpuicore.R;

/**
 * Author by lp,on 2021/7/1/001,14:22.
 * 帧动画
 */
public class FrameFragment extends BaseFragment {

    @Override
    int getFragmentLayoutId() {
        return R.layout.fragment_amin_frame;
    }

    @Override
    String getTitle() {
        return "帧动画";
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = super.onCreateView(inflater, container, savedInstanceState);
        initView();
        return view;
    }

    private void initView() {
        baseAnimView.setBackgroundResource(R.drawable.frame_anim);
        AnimationDrawable drawable= (AnimationDrawable) baseAnimView.getBackground();
        getFragmentView().findViewById(R.id.btn_start).setOnClickListener(v -> {
            drawable.start();
        });
        getFragmentView().findViewById(R.id.btn_stop).setOnClickListener(v -> {
            drawable.stop();
        });



    }
}
